<script type="text/html" template
        lay-url="{{ window.globalConfig.url_product + '/' + layui.router().search.product_id }}"
        lay-done="layui.data.done(d);">
    <title>产品详情</title>

    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">
                        <a href="javascript:history.back()"
                           class="layui-btn layui-btn-primary layui-btn-sm" id="goBack">返回上级</a>
                        {{ d.data.name }}
                    </div>
                    <div class="layui-card-body">
                        <button class="layui-btn layui-btn-primary  layui-bg-blue layui-btn-sm" id="addContent">添加内容</button>

                        <div class="layui-form" lay-filter="LAY-home-product-listform"
                             id="LAY-home-product-listform"
                             style="padding: 20px 30px 0 0;">

                            <div class="layui-tab layui-tab-brief"  lay-filter="lay-products-header"  lay-allowclose="true">
                                <ul class="layui-tab-title">
                                    <li class="layui-this" lay-allowclose="false">基础信息</li>
                                    <li lay-allowclose="false">SEO</li>
                                    <li lay-allowclose="false">拓展分类</li>
                                    {{# if(d.data.product_id){ }}
                                    <li lay-allowclose="false">产品相册</li>
                                    {{# } }}
                                </ul>
                                <div class="layui-tab-content">

                                    <!-- 基础信息 -->
                                    <div class="layui-tab-item layui-show">

                                        <!-- 产品名称 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">产品名称</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="name" value="{{ d.data.name || '' }}"
                                                       lay-verify="required"
                                                       placeholder="请输入产品名称" autocomplete="off"
                                                       class="layui-input"
                                                >
                                            </div>
                                        </div>

                                        <!-- 产品副标题 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">产品副标题</label>
                                            <div class="layui-input-inline">
                                            <textarea name="title" lay-verify="required"
                                                      style="width: 400px; height: 150px;"
                                                      autocomplete="off"
                                                      class="layui-textarea"
                                                      placeholder="产品副标题">{{ d.data.title || '' }}</textarea>
                                            </div>
                                        </div>

                                        <!-- 产品类型 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">产品类型</label>
                                            <div class="layui-input-inline">
                                                <input type="text" id="catName" value=""
                                                       class="layui-input" readonly/>
                                                <input type="hidden" id="catId" name="cate_id"
                                                       value="{{ d.data.cate_id }}"
                                                       class="layui-input"/>

                                            </div>
                                        </div>
                                        <!-- 封面图片 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">封面图片</label>
                                            <div class="layui-input-block">
                                                <div class="layui-upload-list" id="ID-upload-product-btn">

                                                    <img
                                                            {{# if(d.data.cover_img){ }}
                                                            src="{{ window.globalConfig.img_bind_url + d.data.cover_img}}"
                                                            {{# } else { }}
                                                            src="./res/style/imgs/upload.png"
                                                            {{# } }}

                                                            id="ID-upload-product-img" style="max-width: 200px"
                                                            class="layui-upload-img">
                                                </div>
                                            </div>
                                            <input type="hidden" name="cover_img" id="cover_img"
                                                   value="{{ d.data.cover_img }}">
                                        </div>

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">产品说明书</label>
                                            <div class="layui-input-inline">

                                                <div class="layui-input-group">
                                                    <input type="text" readonly name="attachment" id="attachment"
                                                           class="layui-input"
                                                           value="{{ d.data.attachment }}" style="width: 190px;">
                                                    <div class="layui-input-suffix">
                                                        <button class="layui-btn layui-btn-primary"
                                                                id="ID-upload-download-btn">
                                                            上传
                                                        </button>
                                                    </div>
                                                </div>

                                            </div>
                                        </div>

                                        <!-- 是否显示 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">是否显示</label>
                                            <div class="layui-input-inline">
                                                <input type="checkbox" name="is_show" title="开启|关闭" value="1"
                                                       lay-skin="switch"
                                                       {{# if(d.data.is_show == undefined){d.data.is_show = 1 } }}
                                                       {{# if(d.data.is_show){ }}
                                                       checked
                                                       {{# } }}
                                                >
                                            </div>
                                        </div>


                                        <!-- 排序 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">排序</label>
                                            <div class="layui-input-inline">
                                                <input type="number" name="sort" lay-affix="number" min="0"
                                                       value="{{ d.data.sort | 0 }}"
                                                       lay-verify="required|number" placeholder="请输入排序"
                                                       autocomplete="off"
                                                       class="layui-input">
                                            </div>
                                        </div>

                                        <!-- 产品概述 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">产品概述</label>
                                            <div class="layui-input-inline">
                                            <textarea name="pdt_desc"
                                                      style="width: 400px; height: 150px;"
                                                      autocomplete="off"
                                                      class="layui-textarea"
                                                      placeholder="请输入产品概述">{{ d.data.pdt_desc || '' }}</textarea>
                                            </div>
                                        </div>

                                    </div>

                                    <!-- SEO -->
                                    <div class="layui-tab-item">

                                        <!-- 自定义路由 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">自定义路由</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="rewrite_url" value="{{ d.data.rewrite_url }}"
                                                       lay-verify="required"
                                                       placeholder="请输入自定义路由" autocomplete="off"
                                                       class="layui-input">
                                            </div>
                                        </div>

                                        <!-- SEO标题 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">SEO标题</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="seo_title" value="{{ d.data.seo_title }}"
                                                       lay-verify="required"
                                                       placeholder="请输入SEO标题" autocomplete="off"
                                                       class="layui-input">
                                            </div>
                                        </div>

                                        <!-- SEO关键词 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">SEO关键词</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="seo_keywords" value="{{ d.data.seo_keywords }}"
                                                       lay-verify="required"
                                                       placeholder="请输入SEO关键词" autocomplete="off"
                                                       class="layui-input">
                                            </div>
                                        </div>

                                        <!-- SEO描述 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">SEO描述</label>
                                            <div class="layui-input-inline">
                                    <textarea name="seo_desc" lay-verify="required" style="width: 400px; height: 150px;"
                                              autocomplete="off"
                                              class="layui-textarea" placeholder="请输入SEO描述">{{ d.data.seo_desc || '' }}</textarea>
                                            </div>
                                        </div>

                                    </div>

                                    <!-- 拓展分类 -->
                                    <div class="layui-tab-item">
                                        <!--  拓展分类  -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">拓展分类</label>
                                            <div class="layui-input-inline" style="width: 100%">
                                                <div id="ID-product-tree-extCat"></div>
                                            </div>
                                        </div>
                                    </div>

                                    <!-- 产品相册 -->
                                    <div class="layui-tab-item">
                                        <div style="padding-bottom: 10px;">
                                            <button class="layui-btn layuiadmin-btn-list addFiles-0">双击添加</button>
                                        </div>
                                        <table id="LAY-home-product-photos-list"
                                               lay-filter="LAY-home-product-photos-list"></table>

                                    </div>

                                </div>
                            </div>

                            <input type="hidden" name="product_id" value="{{ d.data.product_id }}">
                            <div class="layui-form-item">
                                <label class="layui-form-label"></label>
                                <div class="layui-input-inline">
                                    <input type="button" lay-submit
                                           lay-filter="LAY-home-product-listform-submit"
                                           value="保存"
                                           class="layui-btn">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</script>
<script type="text/html" id="LAY-home-product-files-tools">
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i
            class="layui-icon layui-icon-delete"></i>删除</a>
</script>


<script type="text/html" id="ID-table-product-files-is_show-switch">
  <!-- 这里的 checked 的状态值判断仅作为演示 -->
  <input type="checkbox" name="is_show" value="{{= d.product_id }}" title="是|否" lay-skin="switch" lay-filter="product-is_show-status" {{= d.is_show == 1 ? "checked" : "" }}>
</script>

<script src="res/modules/product.js"></script>
